package com.cjx.auth.feign;


import com.cjx.auth.feign.impl.AuthFeignFallback;
import com.cjx.common.api.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;

/**
*@Description 授权feign
*@Verson v1.0.0
*@Author cjunxian
*@Date
*/
@FeignClient(value = "cjx-auth-service",fallback = AuthFeignFallback.class)
@Component
public interface AuthFeign {

    /**
     * Oauth2获取token
     * @param parameters
     * @return
     * @throws HttpRequestMethodNotSupportedException
     */
    @PostMapping("/oauth/token")
    CommonResult postAccessToken(@RequestParam Map<String, String> parameters);

    /**
     * 获取公钥
     * @return
     */
    @GetMapping("/rsa/getPublicKey")
    Map<String, Object> loadPublicKey();
}
